<?php

namespace app\admin\controller;

use think\Controller;

class Index extends Controller
{
    public function initialize()
    {
        session('webInfo', model('System')->find());
    }

    public function index()
    {
        if (request()->isPost()) {
            $data = input();
            $result = model('Admin')->login($data);
            if ($result == 1) {
                return $this->success('登录成功！','admin/home/index');
            }else {
                return $this->error($result);
            }
        }
        return view('login');
    }
}
